#!/bin/bash #Emil curl -s 'https://www.destroyallsoftware.com/screencasts/catalog' | grep -oP '/screencasts/catalog/[^"]+' | sed 's;^;https\:\/\/www\.destroyallsoftware\.com;g' | while read -r i do file=$(curl -s "$i" | grep -oP '(?<=source.src = ")https\:\/\/destroyallsoftware\.s3\.amazonaws\.com/.+\.mp4?.+?(?=";)') link="" if [[ "${file}" =~ '4k.mp4?' ]] then link=$(echo "${file}" | grep -P '4k.mp4?') elif [[ "${file}" =~ '1080p.mp4?' ]] then link=$(echo "${file}" | grep -P '1080p.mp4?') else link=$(echo "${file}" | head -n 1) fi name=$(echo "${link}" | grep -oP '[^/](?:(?!.mp4)[^/])+\.mp4') echo "curl -L -o '${name}' '${link}'" done | parallel --jobs "${1:-4}" "{}"